import sys

x = list(input())

a = (int(x[0])+3)%9
b = (int(x[1])+3)%9
c = (int(x[2])+3)%9
d = (int(x[3])+3)%9

print(c,d,a,b,sep='')